"""Added BonusHistory model

Revision ID: 1457db00897c
Revises: f86e9c7be403
Create Date: 2024-02-13 10:34:47.173651

"""
import sqlalchemy as sa
from alembic import op

# revision identifiers, used by Alembic.
revision = "1457db00897c"
down_revision = "f86e9c7be403"
branch_labels = None
depends_on = None


def upgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.create_table(
        "bonus_history",
        sa.Column("id", sa.Integer(), nullable=False),
        sa.Column("user_id", sa.Integer(), nullable=True),
        sa.Column("operation_type", sa.Enum("ACCRUAL", "DEDUCTION", name="operationtype"), nullable=False),
        sa.Column("amount", sa.Integer(), nullable=False),
        sa.Column("created_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.Column("updated_at", sa.DateTime(), server_default=sa.text("now()"), nullable=True),
        sa.ForeignKeyConstraint(["user_id"], ["user.id"], name=op.f("fk_bonus_history_user_id_user")),
        sa.PrimaryKeyConstraint("id", name=op.f("pk_bonus_history")),
    )
    # ### end Alembic commands ###


def downgrade() -> None:
    # ### commands auto generated by Alembic - please adjust! ###
    op.drop_table("bonus_history")
    # ### end Alembic commands ###
